Skip to content

perf: skip preprocessOutParam for noMVars queries#12489

Draft
kim-em wants to merge 1 commit intomasterfrom
revert-tc-cache-preprocessOutParam
Draft

perf: skip preprocessOutParam for noMVars queries#12489
kim-em wants to merge 1 commit intomasterfrom
revert-tc-cache-preprocessOutParam

Conversation

@kim-em
Copy link
Collaborator

@kim-em kim-em commented Feb 15, 2026

This PR restores the optimization of skipping the preprocessOutParam step when the type has no metavariables, reverting one of the workarounds from #12286 needed for Mathlib compatibility. (See #12488 for the other.)

The preprocessOutParam step is morally not needed when the type has no metavariables, because output params should be uniquely determined by the input params. The optimization was removed in #12286 because semireducible type aliases like OrderDual caused TC resolution to fail. For example, synthesizing FunLike F (OrderDual α) (OrderDual β) where the last two arguments are output parameters: without preprocessOutParam, TC resolution fails because it cannot unfold OrderDual since it is semireducible.

This is an experimental branch for exploring changes to Mathlib.

🤖 Prepared with Claude Code

@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Feb 15, 2026
@mathlib-lean-pr-testing
Copy link

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 0d2a511bde100b0c8690bee398b52c1b715e618f --onto 6ca23a7b8bee57152110ce500ce795148707d4ed. You can force Mathlib CI using the force-mathlib-ci label. (2026-02-15 04:30:37)

@leanprover-bot
Copy link
Collaborator

leanprover-bot commented Feb 15, 2026

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 0d2a511bde100b0c8690bee398b52c1b715e618f --onto 9da8f5dce42832b8411d58446653f3640a94a6e3. You can force reference manual CI using the force-manual-ci label. (2026-02-15 04:30:39)
  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2026-02-15-rev1 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-manual, reference manual CI should run now. You can force reference manual CI using the force-manual-ci label. (2026-02-15 22:41:54)

This reverts part of the `OrderDual` workaround from #12286.

The `preprocessOutParam` step is morally not needed when the type has
no metavariables, because output params should be uniquely determined
by the input params. The optimization was removed because
semireducible type aliases like `OrderDual` caused TC resolution to
fail (e.g. `FunLike F (OrderDual α) (OrderDual β)` where the last
two arguments are output parameters — without `preprocessOutParam`,
TC resolution fails because it cannot unfold `OrderDual`).

This is an experimental branch for testing whether Mathlib's
`OrderDual` refactoring has progressed enough to restore this
optimization.
@kim-em kim-em force-pushed the revert-tc-cache-preprocessOutParam branch from 1c86055 to f46005f Compare February 15, 2026 21:47
mathlib-nightly-testing bot pushed a commit to leanprover-community/batteries that referenced this pull request Feb 15, 2026
@github-actions github-actions bot added the mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN label Feb 15, 2026
mathlib-nightly-testing bot pushed a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Feb 15, 2026
@mathlib-lean-pr-testing mathlib-lean-pr-testing bot added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Feb 15, 2026
@mathlib-lean-pr-testing
Copy link

Mathlib CI status (docs):

@mathlib-lean-pr-testing
Copy link

Mathlib CI status (docs):

kim-em added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Feb 17, 2026
Adapt 14 Mathlib files for changes in leanprover/lean4#12489.
Fixes from SG_newBranch (lean4#12286 adaptations) plus additional
fix for NonUnitalHom.prod.map_smul' proof.

Remaining blockers:
- Mathlib.Order.Hom.WithTopBot (DFunLike instance synthesis with Option/WithTop)
- Mathlib.CategoryTheory.Functor.TypeValuedFlat (no existing fix)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mathlib-lean-pr-testing
Copy link

Mathlib CI status (docs):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants